var e = require;
var t = module;
var n = exports;
Object.defineProperty(n, "__esModule", {
    value: !0
});
var o = e("OpenBoxMgr"),
    i = e("RecorderPanel"),
    a = e("VideoHint"),
    r = e("UIManager"),
    s = e("YaoshuiMgr"),
    c = cc._decorator,
    l = c.ccclass,
    d = c.property,
    h = function (e) {
        __extends(t, e);
        function t() {
            var t = null !== e && e.apply(this, arguments) || this;
            t.panel_fail = null;
            t.panel_success = null;
            t.failLable = null;
            t.successLable = null;
            t.juqingSprite = null;
            t.juqingSpriteFrame = [];
            t.endSuccessBtnNode1 = null;
            t.endSuccessBtnNode2 = null;
            t.endFailBtnNode1 = null;
            t.endFailBtnNode2 = null;
            t.hasBeingKing = !1;
            t.juqingArr1 = ["你笑起来真好看，安慰一下", "出来混总是还的啦", "刺杀失败，将在监狱中度过一生"];
            t.juqingArr2 = ["国王的双十一，看啥啥火爆", "喜提国王，小心前方青蛙", "喜提国王，小心刺客横行"];
            return t
        }
        n = t;
        t.prototype.onLoad = function () {
            n.Instance = this
        };
        t.prototype.showSuccess = function () {
            SDK.Base.Event.emit("PanelOpen");
            n.showCount++;
            SDK.Mgr.Inst.closeBanner();
            this.scheduleOnce(function () {
                o.default.Instance.openPanel()
                SDK.Mgr.Inst.showInsert()
            },
                .5);
            i.default.GamePause = !0;
            this.panel_success.active = !0;
            var e = Math.floor(Math.random() * this.juqingSpriteFrame.length);
            this.juqingSprite.spriteFrame = this.juqingSpriteFrame[e];
            var t = Math.floor(Math.random() * this.juqingArr2.length);
            this.successLable.string = this.juqingArr2[t];
            if (SDK.Mgr.Inst.isAdOpen) if (n.showCount % 2 == 1) {
                this.endSuccessBtnNode1.active = !0;
                this.endSuccessBtnNode2.active = !1
            } else {
                this.endSuccessBtnNode1.active = !1;
                this.endSuccessBtnNode2.active = !0
            }
        };
        t.prototype.showFail = function () {
            SDK.Base.Event.emit("PanelOpen");
            SDK.Mgr.Inst.closeBanner();
            n.showCount++;
            n.showFailCount++;
            this.scheduleOnce(function () {
                SDK.Mgr.Inst.showInsert()
            },
                1.5);
            this.panel_fail.active = !0;
            i.default.GamePause = !0;
            var e = Math.floor(Math.random() * this.juqingArr1.length);
            this.failLable.string = this.juqingArr1[e];
            if (SDK.Mgr.Inst.isAdOpen) if (n.showCount % 2 == 1) {
                this.endFailBtnNode1.active = !0;
                this.endFailBtnNode2.active = !1
            } else {
                this.endFailBtnNode1.active = !1;
                this.endFailBtnNode2.active = !0
            }
            SDK.Mgr.Inst.curChannel == SDK.Define.Channel.oppo && SDK.Mini.OPPO.Extend.Inst.hasBoxAd() && SDK.Mgr.Inst.customData && "true" == SDK.Mgr.Inst.customData.openBoxStrong && SDK.Mgr.Inst.isAdOpen && this.scheduleOnce(function () {
                SDK.Mini.OPPO.Extend.Inst.showBoxPortal()
            },
                .5)
        };
        t.prototype.closePanel = function () {
            SDK.Base.Event.emit("PanelClose");
            i.default.GamePause = !1;
            if (this.panel_fail.active) {
                this.panel_fail.active = !1;
                n.showFailCount > 1 && SDK.Mgr.Inst.curChannel == SDK.Define.Channel.vivo && this.scheduleOnce(function () {
                    r.default.Inst.showView(r.E_GameView.tryUse)
                },
                    .5)
            }
            this.panel_success.active && (this.panel_success.active = !1);
            SDK.Mgr.Inst.curChannel != SDK.Define.Channel.oppo && SDK.Mgr.Inst.curChannel != SDK.Define.Channel.vivo && SDK.Mgr.Inst.showBanner()
        };
        t.prototype.showVideo = function () {
            var e = this,
                t = "EndSuccess_Ad";
            SDK.Mgr.Inst.event(t + "Click");
            var n = function (o) {
                if (o == SDK.Define.AdsCode.finish) {
                    SDK.Mgr.Inst.event(t + "Success");
                    i.default.GamePause = !1;
                    e.panel_success.active = !1;
                    if (null != KingController.Instance) {
                        KingController.Instance.DrinkRedWine();
                        s.default.RedYao = !0;
                        SDK.ToastMgr.Inst.showToast("获得长生药水")
                    }
                } else if (o == SDK.Define.AdsCode.cancel) {
                    SDK.Mgr.Inst.event(t + "Cancel");
                    a.default.Instance.openPanel(n)
                } else {
                    SDK.ToastMgr.Inst.showToast("暂无广告，请稍后再试");
                    SDK.Mgr.Inst.event(t + "NoAd")
                }
            };
            SDK.Mgr.Inst.showVideo(n)
        };
        var n;
        t.Instance = null;
        t.showCount = 0;
        t.showFailCount = 0;
        __decorate([d(cc.Node)], t.prototype, "panel_fail", void 0);
        __decorate([d(cc.Node)], t.prototype, "panel_success", void 0);
        __decorate([d(cc.Label)], t.prototype, "failLable", void 0);
        __decorate([d(cc.Label)], t.prototype, "successLable", void 0);
        __decorate([d(cc.Sprite)], t.prototype, "juqingSprite", void 0);
        __decorate([d([cc.SpriteFrame])], t.prototype, "juqingSpriteFrame", void 0);
        __decorate([d(cc.Node)], t.prototype, "endSuccessBtnNode1", void 0);
        __decorate([d(cc.Node)], t.prototype, "endSuccessBtnNode2", void 0);
        __decorate([d(cc.Node)], t.prototype, "endFailBtnNode1", void 0);
        __decorate([d(cc.Node)], t.prototype, "endFailBtnNode2", void 0);
        return n = __decorate([l], t)
    }(cc.Component);
n.default = h